My new Columns are not visible, how should I fix it?

Dear Forum-Mates,

I have created two new user specific Attributes and two Columns for that Attributes.
Everything is fine, it works without error messages but when I open the created module manually the new Columns are not visible. The Attributes are stored in the module but to show the Columns I have to insert it manually. What do I wrong?

To being sure, I tried the following:

Column c 
for c in current Module do print (title c) "\n"


and my new Columns were really there. But not later when the script ends and I open the module manually.

My example code:

 

/* --------------------------------------------------------------------------- */
/* Creates or (when already exists) the module which will contain the results  */
pragma runLim, 0
 
    string mdlStatFullname = "/M3AR/Radio Scope/tmp/REQ_Statistics"
 
    Module mdlStat
    if (!exists module mdlStatFullname){
        mdlStat = create (mdlStatFullname, "Counting requirements and testcases", "Stat", 1, false)
    } else {
        mdlStat = edit (mdlStatFullname, false)
    }
    current = mdlStat
 
    /* Create the user specific attributes, if the does not exists yet */
    AttrDef adNoReq = find(mdlStat, "No. Req."),
            adNoTc  = find(mdlStat, "No. TC")
    Column  colNoReq, colNoTc, colDummy
    int     numColumns = 0
 
    if (null adNoReq){
        adNoReq = create object type "Integer" attribute "No. Req."
    }
    if (null adNoTc){
        adNoTc = create object type "Integer" attribute "No. TC" 
    }
 
    /* Determine the number of already existing columns */
    for colDummy in mdlStat do numColumns++
 
    string attrNameNoReq = adNoReq.name
    colNoReq = insert (column numColumns)
    attribute(colNoReq, attrNameNoReq)
    width(colNoReq, 200)
    title(colNoReq, attrNameNoReq)
 
    string attrNameNoTc = adNoTc.name
    colNoTc = insert (column numColumns++)
    attribute(colNoTc, attrNameNoTc)
    width(colNoTc, 200)
    title(colNoTc, attrNameNoTc)
 
    /* Create one object for testing reason */
    Object o = null
    if (!null last(mdlStat)){
        o = create(after(last(mdlStat)))
    } else {
        o = create(mdlStat)
    }
    o."Object Heading" = identifier(o)
    o."Object Text" = identifier(o)
    o."No. Req." = 100 //only example
    o."No. TC" = 150 //only example
 
    save(mdlStat)
    close (mdlStat)
    refreshDBExplorer
/* --------------------------------------------------------------------------- */



Thank You all!

vasgyuszi



 


vasgyuszi - Wed Mar 17 05:40:00 EDT 2010

Re: My new Columns are not visible, how should I fix it?
PDU - Wed Mar 17 06:47:52 EDT 2010

Hello,

First note, i think you have a little bug :

for colDummy in mdlStat do numColumns++
 //...
    colNoReq = insert (column numColumns)
//...
 
    colNoTc = insert (column numColumns++)
//...


second column is inserted in the same place than first !

For your problem, if you whant retreive columns when opening Module, you must create a view just after create columns :

 

save(view("the name of your view"))


If you want that this view is opened when you open the Module :

 

 

setDefaultViewForUser(mdlStat , "the name of your view"))


Pierre

 

Re: My new Columns are not visible, how should I fix it?
vasgyuszi - Wed Mar 17 07:17:58 EDT 2010

PDU - Wed Mar 17 06:47:52 EDT 2010

Hello,

First note, i think you have a little bug :

for colDummy in mdlStat do numColumns++
 //...
    colNoReq = insert (column numColumns)
//...
 
    colNoTc = insert (column numColumns++)
//...


second column is inserted in the same place than first !

For your problem, if you whant retreive columns when opening Module, you must create a view just after create columns :

 

save(view("the name of your view"))


If you want that this view is opened when you open the Module :

 

 

setDefaultViewForUser(mdlStat , "the name of your view"))


Pierre

 

Dear Pierre,

thanks alot for the quick help!
It works perfecly. Excellent!

Best regards,
vasgyuszi